package com.yuanfeng.activity.controller;


import com.yuanfeng.activity.dto.FinishTimeSecondkillDTO;
import com.yuanfeng.activity.dto.ManageSeckillBaseQueryDTO;
import com.yuanfeng.activity.dto.SecondKillGoodsDTO;
import com.yuanfeng.commoms.dto.goods.ManageSeckillBaseUpdateDTO;
import com.yuanfeng.commoms.util.ResponseResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @ClassName ActivitySeckillBaseController
 * @Description  限时秒杀活动表
 * @Author ty
 * @Date 2023-07-04 17:26:45
 * @Version 1.0
 **/
@RestController
@RequestMapping("activitySeckillBase")
public class ActivitySeckillBaseController extends BaseController{

    /**
     * 组件化装修 限时秒杀活动列表
     * @param param
     * @return
     */
    @PostMapping("/get/list")
    public ResponseResult getList(@RequestBody(required = false) FinishTimeSecondkillDTO param) {
        ResponseResult result = activitySeckillBaseService.getList(param);
        return result;
    }

    /**
     * 组件化装修 限时秒杀活动列表
     * @param param
     * @return
     */
    @PostMapping("/get/ByPage")
    public ResponseResult getByPage(@RequestBody(required = false) FinishTimeSecondkillDTO param) {
        return activitySeckillBaseService.getByPage(param);
    }


    /**
     * 限时秒杀活动删除
     * @param param
     * @return
     */
    @PostMapping("/delete/data")
    public ResponseResult deleteData(@RequestBody(required = false) SecondKillGoodsDTO param) {
        ResponseResult result=activitySeckillBaseService.deleteData(param);
        return result;
    }


    /**
     * 删除店铺秒杀活动详情
     *
     * @param param
     * @return
     */
    @PostMapping("/delete")
    public ResponseResult deleteShopSeckillBase(@RequestBody Map<String,Object> param) {
        ResponseResult result=activitySeckillBaseService.deleteShopSeckillBase(param);
        return result;
    }

    /**
     * 复制限时秒杀活动
     *
     * @param param
     * @return
     */
    @PostMapping("/copy")
    public ResponseResult queryShopSeckilCopy(@RequestBody Map<String, Object> param) {
        ResponseResult result=activitySeckillBaseService.queryShopSeckilCopy(param);
        return result;
    }


    /**
     * 查询店铺秒杀活动列表
     *
     * @param param
     * @return
     */
    @PostMapping("/query/list")
    public ResponseResult queryShopSeckillBaseList(@RequestBody ManageSeckillBaseUpdateDTO param) throws IllegalAccessException {
        ResponseResult result=activitySeckillBaseService.queryShopSeckillBaseList(param);
        return result;
    }

    /**
     * 查询店铺秒杀活动详情
     *
     * @param param
     * @return
     */
    @PostMapping("/base/query")
    public ResponseResult queryShopSeckillBase(@RequestBody ManageSeckillBaseQueryDTO param) {
        ResponseResult result = activitySeckillBaseService.queryShopSeckillBase(param);
        return result;
    }



    /**
     * 创建或更新店铺秒杀活动
     *
     * @param param
     * @return
     */
    @PostMapping("/add")
    public ResponseResult addShopSeckillBase(@RequestBody ManageSeckillBaseUpdateDTO param) {
        ResponseResult result = activitySeckillBaseService.addShopSeckillBase(param);
        return result;
    }
}
